package Tests
import org.scalatest.FunSuite
import ru.mipt.board.net._
import scala.actors.Actor._

/**
 * Created by IntelliJ IDEA.
 * User: IL
 * Date: 19.09.2010
 * Time: 14:44:42
 * To change this template use File | Settings | File Templates.
 */

class WorkingActorTest extends FunSuite {
    test("abilty to parse mutitudy of threads and send back result") {
        val actor1 = new WorkingActor
        val actor2 = new WorkingActor
        var content: List[BoardMessage] = List();
        actor1.start
        actor2.start
        val mockmainactor = actor {
            loop {
                react {
                    case a: List[BoardMessage] => content = a ::: content
                    case _ => assert(false,"unexpected message")
                }
            }
        }
        actor1 ! (6715752, mockmainactor)
        actor2 ! (6715739, mockmainactor)
        actor1 ! (6715719, mockmainactor)
        Thread.sleep(5000) //TODO do something
        assert(content.size == 27)
    }
}